import java.util.Scanner;

public class Array_expansion {
    public static void main(String[] args){
        //1.获取用户输入的数组长度（用户自定所以标记为变量）
        System.out.print("请输入数组的长度:");
        Scanner sc =  new Scanner(System.in);
        int capacity = sc.nextInt();
        int[] arr = new int[capacity];

        //2.获取用户在数组中插入的元素并赋值给数组arr
        int input_num = 0;
        for(int j = 0; j < arr.length; j++){
            System.out.print("请输入要在数组中插入的元素：");
             input_num = sc.nextInt();
             arr[j] = input_num;
        }

        //3.遍历输出数组中的内容
        int len = 0;
        System.out.print("数组中的内容是：" );
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
            len += 1;

        //4.当数组中已储存的内容超过数组总容量的80%时进行扩容1.5倍
            if (len >= (0.8 * capacity)) {
                System.out.println();
                System.out.println("扩容前的容量是：" + capacity);
                capacity = (int) (capacity * 1.5);
                System.out.print("扩容后的容量是：" + capacity);
                break;
            }
        }

    }
}
